﻿/**
 * 公共dialog插件，方便外层程序使用编辑器的dialog功能
 */
(function(E, $){
var Consts = E.consts,
	Panel = E.mod('Panel'),
	self = null;
	
E.plugin("Dialog", {
	title: '提示',
	
	config:{
		width: 350,
		position: 'center',
		overlay: true
	},
	
	show: function( title, html, width, callback){
		var winW = $(window).width();
		width = (typeof width === "number") ? width : 350;
		if( width < 200  ) {width = 200;}
		if( width > winW ) {width = winW;}
		if(title) {
			self.title = title;
		}
		self.config.width = width;
		
		self.cache['html'] = html;
		Panel.set(self);
	},
	showError: function( text ){
		var html = '<table width="100%"><tr><td valign="center" align="center" style="height:150px;line-height:150%;color:red;">'+text+'</td></tr></table>';
		self.show("提示", html);
	},
	
	showNotice: function( text ){
		var html = '<table width="100%"><tr><td valign="center" align="center" style="height:180px;line-height:150%;color:#666666;">'+text+'</td></tr></table>';
		self.show("提示", html);
	}
});

self = E.plugin("Dialog");

})(jQEditor, jQuery);